<%@ page import="com.portico.dept.solarch.ProjectDashboard" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'projectDashboard.label', default: 'ProjectDashboard')}"/>
    <title><g:message code="default.edit.label" args="[entityName]"/></title>
</head>

<body>
%{--<div class="nav">--}%
%{--<span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>--}%
%{--<span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>--}%
%{--<span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>--}%
%{--</div>--}%
<div class="body">
    <h1><g:message code="default.edit.label" args="[entityName]"/></h1>
    <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${projectDashboardInstance}">
        <div class="errors">
            <g:renderErrors bean="${projectDashboardInstance}" as="list"/>
        </div>
    </g:hasErrors>
    <g:form method="post">
        <g:hiddenField name="id" value="${projectDashboardInstance?.id}"/>
        <g:hiddenField name="version" value="${projectDashboardInstance?.version}"/>
        <div class="dialog">
            <table>
                <tbody>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="trend"><g:message code="projectDashboard.trend.label" default="Trend"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'trend', 'errors')}">
                        <g:select name="trend" from="${projectDashboardInstance.constraints.trend.inList}"
                                  value="${projectDashboardInstance?.trend}"
                                  valueMessagePrefix="projectDashboard.trend"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="currentStatus"><g:message code="projectDashboard.currentStatus.label"
                                                              default="Current Status"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'currentStatus', 'errors')}">
                        <g:select name="currentStatus"
                                  from="${projectDashboardInstance.constraints.currentStatus.inList}"
                                  value="${projectDashboardInstance?.currentStatus}"
                                  valueMessagePrefix="projectDashboard.currentStatus"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="budget"><g:message code="projectDashboard.budget.label" default="Budget"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'budget', 'errors')}">
                        <g:select name="budget" from="${projectDashboardInstance.constraints.budget.inList}"
                                  value="${projectDashboardInstance?.budget}"
                                  valueMessagePrefix="projectDashboard.budget"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="resources"><g:message code="projectDashboard.resources.label"
                                                          default="Resources"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'resources', 'errors')}">
                        <g:select name="resources" from="${projectDashboardInstance.constraints.resources.inList}"
                                  value="${projectDashboardInstance?.resources}"
                                  valueMessagePrefix="projectDashboard.resources"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="timeline"><g:message code="projectDashboard.timeline.label"
                                                         default="Timeline"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'timeline', 'errors')}">
                        <g:select name="timeline" from="${projectDashboardInstance.constraints.timeline.inList}"
                                  value="${projectDashboardInstance?.timeline}"
                                  valueMessagePrefix="projectDashboard.timeline"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="quality"><g:message code="projectDashboard.quality.label"
                                                        default="Quality"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'quality', 'errors')}">
                        <g:select name="quality" from="${projectDashboardInstance.constraints.quality.inList}"
                                  value="${projectDashboardInstance?.quality}"
                                  valueMessagePrefix="projectDashboard.quality"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="scope"><g:message code="projectDashboard.scope.label" default="Scope"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'scope', 'errors')}">
                        <g:select name="scope" from="${projectDashboardInstance.constraints.scope.inList}"
                                  value="${projectDashboardInstance?.scope}"
                                  valueMessagePrefix="projectDashboard.scope"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="voc"><g:message code="projectDashboard.voc.label" default="Voc"/></label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean: projectDashboardInstance, field: 'voc', 'errors')}">
                        <g:select name="voc" from="${projectDashboardInstance.constraints.voc.inList}"
                                  value="${projectDashboardInstance?.voc}" valueMessagePrefix="projectDashboard.voc"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="comments"><g:message code="projectDashboard.comments.label"
                                                         default="Comments"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'comments', 'errors')}">
                        <g:textArea name="comments" cols="40" rows="5" value="${projectDashboardInstance?.comments}"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="project"><g:message code="projectDashboard.project.label"
                                                        default="Project"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectDashboardInstance, field: 'project', 'errors')}">
                        <g:select name="project.id" from="${com.portico.dept.solarch.Project.list()}" optionKey="id"
                                  value="${projectDashboardInstance?.project?.id}"/>
                    </td>
                </tr>

                </tbody>
            </table>
        </div>

        <div class="buttons">
            <span class="button"><g:actionSubmit class="save" action="update"
                                                 value="${message(code: 'default.button.update.label', default: 'Update')}"/></span>
            <sec:ifAnyGranted roles="ROLE_SUPER_USER, ROLE_ADMIN_USER">

                <span class="button"><g:actionSubmit class="delete" action="delete"
                                                     value="${message(code: 'default.button.delete.label', default: 'Delete')}"
                                                     onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');"/></span>
            </sec:ifAnyGranted>
        </div>
    </g:form>
</div>
</body>
</html>
